package com.butterfly.mvc.action;

import com.butterfly.mvc.annotation.Controller;
import com.butterfly.mvc.annotation.ReqType;
import com.butterfly.mvc.annotation.RequestMapping;
import com.butterfly.mvc.form.ActionForm;
import com.butterfly.mvc.form.LoginForm;
import com.butterfly.mvc.servlet.DispatchServlet;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by WOLF on 2016/9/19.
 */
@Controller("user")
public class LoginAction{

    @RequestMapping(value = "login",method = ReqType.GET)
    public String login(HttpServletRequest request, HttpServletResponse response) {
        System.out.println("in method login");
        return "login";
    }

    @RequestMapping(value = "doLogin",method = ReqType.POST)
    public String doLogin(LoginForm formBean, HttpServletRequest request, HttpServletResponse response) {
        System.out.println("in method doLogin");
        return DispatchServlet.REDIRECT+"index/index.do";
    }
}
